home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Finder Dungeon / source code / MoreFiles 1.4.6 / Pascal Interfaces / DirectoryCopy.p next >
Encoding:
Text File  |  1997-06-28  |  3.7 KB  |  114 lines  |  [TEXT/MPS ]

  1. UNIT DirectoryCopy;
  2.  
  3. {    Apple Macintosh Developer Technical Support                                }
  4. {                                                                            }
  5. {    DirectoryCopy: A robust, general purpose directory copy routine.        }
  6. {    by Jim Luther, Apple Developer Technical Support Emeritus                }
  7. {                                                                            }
  8. {    File:        DirectoryCopy.p                                                }
  9. {                                                                            }
  10. {    Copyright © 1992-1996 Apple Computer, Inc.                                }
  11. {    All rights reserved.                                                    }
  12. {                                                                            }
  13. {    You may incorporate this sample code into your applications without        }
  14. {    restriction, though the sample code has been provided "AS IS" and the    }
  15. {    responsibility for its operation is 100% yours.  However, what you are    }
  16. {    not permitted to do is to redistribute the source as "DSC Sample Code"    }
  17. {    after having made changes. If you're going to re-distribute the source,    }
  18. {    we require that you make it clear in the source that the code was        }
  19. {    descended from Apple Sample Code, but that you've made changes.            }
  20.  
  21.  
  22. INTERFACE
  23.  
  24.     USES
  25.         Types, Files;
  26.  
  27. {***************************************************************************}
  28.  
  29.     { DirectoryCopy failedOperation codes. }
  30.     CONST
  31.         getNextItemOp = 1;            { couldn't access items in this }
  32.                                     { directory - no access privileges }
  33.         copyDirCommentOp = 2;        { couldn't copy directory's Finder }
  34.                                     { comment }
  35.         copyDirAccessPrivsOp = 3;    { couldn't copy directory's AFP access }
  36.                                     { privileges }
  37.         copyDirFMAttributesOp = 4;    { couldn't copy directory's File }
  38.                                     { Manager attributes }
  39.         dirCreateOp = 5;            { couldn't create destination directory }
  40.         fileCopyOp = 6;                { couldn't copy file }
  41.  
  42.  
  43. {***************************************************************************}
  44.  
  45.     TYPE
  46.         CopyErrProcPtr = ProcPtr;
  47. {    A DirectoryCopy CopyErrProc function should have the following form:    }
  48. {                                                                            }
  49. {    FUNCTION MyCopyErrProc (error: OSErr;                                     }
  50. {                            failedOperation: Integer;                        }
  51. {                            srcVRefNum: Integer;                            }
  52. {                            srcDirID: LongInt;                                }
  53. {                            srcName: StringPtr;                                }
  54. {                            dstVRefNum: Integer;                            }
  55. {                            dstDirID: LongInt;                                }
  56. {                            dstName: StringPtr): Boolean;                    }
  57.  
  58.         CopyFilterProcPtr = ProcPtr;
  59. {    A DirectoryCopy CopyFilterProc function should have the following form:    }
  60. {                                                                            }
  61. {    FUNCTION MyCopyFilterProc (cpbPtr: CInfoPBPtr): Boolean;                }
  62.  
  63. {***************************************************************************}
  64.  
  65.  
  66.     FUNCTION FilteredDirectoryCopy (srcVRefNum: Integer;
  67.                                     srcDirID: LongInt;
  68.                                     srcName: StringPtr;
  69.                                     dstVRefNum: Integer;
  70.                                     dstDirID: LongInt;
  71.                                     dstName: StringPtr;
  72.                                     copyBufferPtr: Ptr;
  73.                                     copyBufferSize: LongInt;
  74.                                     preflight: Boolean;
  75.                                     copyErrHandler: CopyErrProcPtr;
  76.                                     copyFilterProc: CopyFilterProcPtr): OSErr;
  77.  
  78.     FUNCTION FSpDirectoryCopy ({CONST}
  79.                                     VAR srcSpec: FSSpec;
  80.                                     {CONST}
  81.                                     VAR dstSpec: FSSpec;
  82.                                     copyBufferPtr: Ptr;
  83.                                     copyBufferSize: LongInt;
  84.                                     preflight: Boolean;
  85.                                     copyErrHandler: CopyErrProcPtr;
  86.                                     copyFilterProc: CopyFilterProcPtr): OSErr;
  87.  
  88.     FUNCTION DirectoryCopy (srcVRefNum: Integer;
  89.                                     srcDirID: LongInt;
  90.                                     srcName: StringPtr;
  91.                                     dstVRefNum: Integer;
  92.                                     dstDirID: LongInt;
  93.                                     dstName: StringPtr;
  94.                                     copyBufferPtr: Ptr;
  95.                                     copyBufferSize: LongInt;
  96.                                     preflight: Boolean;
  97.                                     copyErrHandler: CopyErrProcPtr): OSErr;
  98.  
  99.     FUNCTION FSpDirectoryCopy ({CONST}
  100.                                     VAR srcSpec: FSSpec;
  101.                                     {CONST}
  102.                                     VAR dstSpec: FSSpec;
  103.                                     copyBufferPtr: Ptr;
  104.                                     copyBufferSize: LongInt;
  105.                                     preflight: Boolean;
  106.                                     copyErrHandler: CopyErrProcPtr): OSErr;
  107.  
  108.  
  109. {***************************************************************************}
  110.  
  111.  
  112. IMPLEMENTATION
  113.  
  114. END.